textmodes/flyspell.el: Don't check pre-word if buffer was switched.
authorAgustin Martin <agustin.martin@hispalinux.es>
Wed, 17 Apr 2013 18:03:46 +0000 (20:03 +0200)
committerAgustin Martin <agustin.martin@hispalinux.es>
Wed, 17 Apr 2013 18:03:46 +0000 (20:03 +0200)
commit892e93203d241746390b06b64481a31f820a41c4
tree80ed401cf8c2d1686bc58c661c32d29bb414dddf
parent168706a2c52873cef2726997769a18a3027823ce
textmodes/flyspell.el: Don't check pre-word if buffer was switched.

If command changed the buffer, the decision may be made based on the
current buffer even though it should based on the previous one.  This
may lead to false positives and more importantly to errors since
`flyspell-pre-point' is buffer local so it may have unsanitised value
(such as nil) in previous buffer.

To be honest, I'm not sure how this can happen since
`flyspell-pre-point' is set in previous buffer, but nonetheless, I've
been encountering the error for quite some time and finally decided to
fix it.  Interestingly, line making `flyspell-pre-point'
a buffer-local variable has a very revealing "Why?? --Stef" comment.

To avoid the problem, change flyspell-check-pre-word-p so that it does
not allow checking of pre-word if command changed buffer
(ie. `flyspell-pre-buffer' is not current buffer).
lisp/ChangeLog
lisp/textmodes/flyspell.el